<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="project.utils.Parser"%>
<%@ page import="project.utils.Utils"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="ws.SPWebService"%>
<%@ page import="ws.WebServiceBean"%>
<%@ page import="project.utils.Utils"%>
<% 
	SPWebService sp = new SPWebService();
	WebServiceBean ws = sp.getWebServiceBeanPort(); 
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Вход</title>
<style type="text/css">
body {
	background-image: url(images/Sport.jpg);
	background-repeat: repeat-y;
}
body,td,th {color: #F60;}
.А {font-family: Verdana, Geneva, sans-serif;}
.В {font-family: Courier New, Courier, monospace;}
.В {font-family: Lucida Console, Monaco, monospace;}
.в {font-family: Comic Sans MS, cursive;}
.в {font-family: Comic Sans MS, cursive;}
a:link {color: #0F0;text-decoration: none;}
a:visited {color: #0F0;text-decoration: none;}
a:hover {text-decoration: none;color: #060;}
a:active {text-decoration: none;color: #F60;}
.green {color: #0F0;}
</style>
</head>

<body>
	<div align="center">
		<table width="864" border="1">
			<tr>
				<th height="185" bgcolor="#000000" scope="col"><h1>
						<strong class="В"><em>PLANET OF SPORT </em></strong><img
							src="images/Planet.jpg" width="260" height="208" alt="" />
					</h1></th>
			</tr>
			<tr>
				<td height="57" bgcolor="#000000"><div align="center">
						<h2>
							<span class="green"><big>ВХОД В СИСТЕМУ</big></span>
						</h2>
					</div></td>
			</tr>
			<tr>
				<td height="294" bgcolor="#000000"><h2 align="center" class="в">&nbsp;</h2>
					<h2 align="center" class="в">Добро пожаловать на наш портал
						&quot;Planet of Sport&quot;</h2>
					<form id="form1" name="form2" method="post" action="">
						<h2 align="center" class="в">Логин:</h2>
						<h2 align="center">
							<span class="в"> <input name="login" type="text" />
							</span>
						</h2>
						<h2 align="center" class="в">Пароль:</h2>
						<h2 align="center">
							<span class="в"> <input type="password" name="password" /></span>
						</h2>
						<p align="center">
							<input type="submit" name="input" value="Войти" />
						</p>
					</form> <%
String login = "Rams666";
 	String password = "1234";
 	if (request.getParameter("input") != null) {
 		String[] dataInput = {request.getParameter("login"), request.getParameter("password")};
 		String[][] responseArray = Utils.toArrays(ws.authorize(Utils.toList(dataInput)));
 		ArrayList<HashMap<String, ArrayList<String>>> answer = Parser.parse(responseArray);
 		if (!answer.isEmpty()){
 			// Инициализируем нужные нам атрибуты
 			session.setAttribute("userid", answer.get(0).get("id").get(0));
 			session.setAttribute("login", answer.get(0).get("login").get(0));
 			session.setAttribute("choosingNumberTournament","-1");
 			session.setAttribute("choosingNumberLeague","-1");
 			session.setAttribute("choosingNumberDiscipline","-1");
 %><jsp:forward page="Home.jsp"></jsp:forward> <%
 	} else
 			out.println("<big><p align=\"center\" style=\"color:red;\">Пароль и (или) логин неверный!</p></big>");
 	}
 %>
					<h3 align="center">&nbsp;</h3>
					<h3 align="center" class="в">
						Если у вас еще нет аккаунта - <a href="Registration.jsp">Зарегистрируйтесь!</a>
					</h3>
					<p align="center">&nbsp;</p>
					<h3 align="center" class="в"></h3></td>
			</tr>
		</table>
	</div>
</body>
</html>
